#! /bin/sh
# Sudivstack - Demo shell script for SUDIVSTACK 
# Author: Mary Palen-Murphy, CSM Dept of Geophysics, 1995
WIDTH=420
HEIGHT=700
WIDTHOFF1=0
WIDTHOFF2=430
WIDTHOFF3=860
HEIGHTOFF=150


# create one shot record
echo "Create one Shot Record"

susynlv nt=630 dt=0.008 ft=0.0 nxo=81 dxo=.05 fxo=0.05 nxs=1 dxs=.05 fxs=0 \
er=0 ob=1 v00=0.75 dvdz=1.5 dvdx=0 smooth=1 \
ref="0.5:0.0,0.10;4.0,0.10" \
ref="0.5:0.0,0.25;4.0,0.25" \
ref="0.5:0.0,0.35;4.0,0.35" \
ref="0.5:0.0,0.50;4.0,0.50" \
ref="0.5:0.0,0.75;4.0,0.75" \
ref="0.5:0.0,1.3;4.0,1.3" \
ref="0.5:0.0,2.0;4.0,2.0" \
ref="0.5:0.0,3.0;4.0,3.0" \
ref="0.5:0.0,3.8;4.0,3.8" \
ref="0.5:0.0,5.0;4.0,5.0" \
ref="0.5:0.0,6.0;4.0,6.0" \
ref="0.5:0.0,7.2;4.0,7.2" \
ref="0.5:0.0,9.0;4.0,9.0" \
ref="0.5:0.0,12.0;4.0,12.0" \
ref="0.5:0.0,15.0;4.0,15.0" \
ref="0.5:0.0,19.0;4.0,19.0" |
sushw key=d2 a=.05 |
sudivcor trms=0.0,1.0,3.0,5.0 \
            vrms=900,1050,1500,2000 > record

# Display shot record
suxwigb < record f2=0.05 title="shot record" windowtitle="shot record" \
	wbox=$WIDTH hbox=$HEIGHT xbox=$WIDTHOFF1 ybox=$HEIGHTOFF &

# Use this for PostScript plot
#supswigp < record f2=0.05 title="shot record" \
# label1="Time(SEC)" label2="Distance(KM)" > record.ps
# test sudivstack

echo "Add noise to one shot record"
suaddnoise < record sn=5 > record.noise
echo "Create duplicate shot records, 3 with no noise, one with noise"
fcat record record.noise > hold
fcat hold record > hold1
fcat hold1 record > record.fcat
echo sort by tracf
susort < record.fcat tracf > record.tracf
echo sustack equally weighted stack
sustack < record.tracf key=tracf > stack 

# Display Stack
suxwigb < stack title="equally weighted stack" windowtitle="equal weights" \
	label1="Time(SEC)" label2="Distance(KM)" f2=0.05 \
	wbox=$WIDTH hbox=$HEIGHT xbox=$WIDTHOFF2 ybox=$HEIGHTOFF &

## Use this for PostScript output
#supswigp < stack title="equally weighted stack" f2=0.05 \
#		label1="Time(SEC)" label2="Distance(KM)" > stack.ps

echo "Computing Diversity Stack" 
sudivstack < record.tracf > divstack

suxwigb < divstack title="diversity stack" windowtitle="diversity stack" \
	label1="Time(SEC)" label2="Distance(KM)" f2=0.05 \
	wbox=$WIDTH hbox=$HEIGHT xbox=$WIDTHOFF3 ybox=$HEIGHTOFF &

## use this for PostScript plot
#supswigp < divstack title="diversity stack" \
#           label1="Time(SEC)" label2="Distance(KM)" f2=0.05 > divstack.ps

exit 0
